See the following HTML example.Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Div
>
IMG
ALT
=''
SRC
= "/Upload/image/111.jpg"
/>
IMG
ALT
=''
SRC
=
PHP uses regular expressions to replace the src content in Img in batches to obtain thumbnails.
This example describes how PHP can obtain thumbnails by replacing the src content in Img in batches based on regular expressions. We will share this with
Get src in all imghtml string text return the picture path as an array public static string[] GetHtmlImageUrlList1 (string htmltext){Regex regimg = new Regex (@ "]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[" "']?[ \s\t\r\n]* (? [^\s\t\r\n "" ' <>]* ") [^<>]*?/?
Scene
Regular expressions are very easy to handle when dealing with very small string lookups, and if you match a string that is slightly more complex, there is no regular expression to do it.
C++11 provides us with a library of regular
Often and pictures to deal with, had to use some of the images to extract SCR, alt, title, and so on attributes, summed up here to everyone some commonly used, feel good, more general!PHP Regular expression matches any attribute in img PHP
Generally, an HTML document has many tags, such as , , and , it is not easy to extract the IMG tags in the document. Because the IMG label style is changeable, it is not easy to use programs to search for it during extraction. Therefore, if you
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.